
#pragma once

#include <stdint.h>

namespace FlameEngine
{
	class AlgorithmHelper
	{
	public:
		//hash function for string
		static uint64_t HashString(const char* pStr);
		
		//djb2 hash function
		static uint32_t Djb2(const char* pStr);

		//sdbm hash function
		static uint32_t Sdbm(const char* pStr);
	};

	class CRC32
	{
	public:
		CRC32() :m_checkSum(0xffffffff){}

		void ProcessByte(const uint8_t* pData, const uint32_t length);

		uint32_t GetCheckSum(){ return ~m_checkSum; }

		void Reset(){ m_checkSum = 0xffffffff; }

	private:
		uint32_t m_checkSum;
		static const uint32_t g_crc32Table[256];;
	};
};
